option_{$option}
Filter HookDescription
Filters the value of an existing option. The dynamic portion of the hook name, `$option`, refers to the option name.Hook Information
File Location |
wp-includes/option.php
View on GitHub
|
Hook Type | Filter |
Line Number | 256 |
Hook Parameters
Type | Name | Description |
---|---|---|
mixed
|
$value
|
Value of the option. If stored serialized, it will be unserialized prior to being returned. |
string
|
$option
|
Option name. |
Usage Examples
Basic Usage
<?php
// Hook into option_{$option}
add_filter('option_{$option}', 'my_custom_filter', 10, 2);
function my_custom_filter($value, $option) {
// Your custom filtering logic here
return $value;
}
Source Code Context
wp-includes/option.php:256
- How this hook is used in WordPress core
<?php
251 *
252 * @param mixed $value Value of the option. If stored serialized, it will be
253 * unserialized prior to being returned.
254 * @param string $option Option name.
255 */
256 return apply_filters( "option_{$option}", maybe_unserialize( $value ), $option );
257 }
258
259 /**
260 * Primes specific options into the cache with a single database query.
261 *
PHP Documentation
<?php
/**
* Filters the value of an existing option.
*
* The dynamic portion of the hook name, `$option`, refers to the option name.
*
* @since 1.5.0 As 'option_' . $setting
* @since 3.0.0
* @since 4.4.0 The `$option` parameter was added.
*
* @param mixed $value Value of the option. If stored serialized, it will be
* unserialized prior to being returned.
* @param string $option Option name.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/option.php
Related Hooks
Related hooks will be displayed here in future updates.